package org.budo.support.spring.rabbitmq;

import org.budo.support.java.net.util.JavaNetUtil;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;

/**
 * @author lmw
 */
public class BudoRabbitmqCachingConnectionFactory extends CachingConnectionFactory {
    @Override
    public void afterPropertiesSet() {
        Boolean reachable = JavaNetUtil.reachable(this.getHost(), this.getPort());
        if (!reachable) {
            throw new IllegalStateException("#14 rabbitmq not ok");
        }

        super.afterPropertiesSet();
    }
}